<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
    <title></title>
</head>
<body>
    <form>
        <textarea type="text" id="reason"/><这是书！>" 这是引用'</textarea>
        <textarea type="text" id="text"/><script>alert("boom!")</script></textarea>
    </form>
    <div onclick="getValue()" style="cursor:pointer;border:1px solid #000;width:50px">提交</div>
    <div id="show"></div>
</body>
<script>
    function checkData(v) {
        var  entry = { "'": "&apos;", '"': '&quot;', '<': '&lt;', '>': '&gt;' };
        v = v.replace(/(['")-><&\\\/\.])/g, function ($0) { return entry[$0] || $0; });
        return v;
    }
    function getValue(){
        var x = document.getElementById("reason");
        var v = checkData(x.value);
        alert(v);
        var boom = document.getElementById("text").value;
        alert(boom);
        
        document.write(v+"<br>");
        document.write(boom);
    }
</script>
</html>